package com.wyz.note.basics.thread;

import java.util.List;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.FutureTask;

/**
 * @Description: 测试类
 * @Author: wei yz
 * @Date: 2023/2/1 10:34
 */
public class BasicsTest {

    public static void main(String[] args) throws ExecutionException, InterruptedException {
//        TestThread tt = new TestThread();
//        tt.start();
//        TestRunnable tt = new TestRunnable();
//        new Thread(tt).start();
        TestCallable callableDemo = new TestCallable();
        FutureTask futureTask = new FutureTask<>(callableDemo);
        new Thread(futureTask).start();
        //获取返回值
        List<Integer> lists = (List<Integer>)futureTask.get();
        for (Integer integer : lists) {
            System.out.print(integer + "  ");
        }
    }
}
